package com.gjq.sensitive.conf;

import com.gjq.sensitive.SensitiveFilter;
import com.gjq.sensitive.template.SensitiveTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: Gjq
 * @Date: 2019/7/3 0003 下午 1:48
 */
@Configuration
@ConditionalOnProperty(prefix = "gjq",name = "sensitive",matchIfMissing = false)
public class SensitiveConfig {
    @Bean
    @ConditionalOnMissingBean
    public SensitiveFilter sensitiveFilter(){
        return new SensitiveFilter();
    }
    @Bean
    @ConditionalOnBean(SensitiveFilter.class)
    public SensitiveTemplate sensitiveTemplate(){
        return new SensitiveTemplate(sensitiveFilter());
    }
}
